package com.hhc.repository;

import com.hhc.entity.CourseInfo;
import java.util.Optional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

/**
 * <p>
 *   课程信息数据库访问层
 * </p>
 * @author pc
 */
@Repository
public interface CourseRepository extends JpaRepository<CourseInfo, Long> {

    @Query("SELECT c FROM CourseInfo c WHERE c.id = :courseId")
    Optional<CourseInfo> findByCourseId(@Param("courseId") Long courseId);

    @Query("SELECT c FROM CourseInfo c WHERE c.status = :status")
    org.springframework.data.domain.Page<CourseInfo> findByStatus(@Param("status") Integer status, org.springframework.data.domain.Pageable pageable);

}
